package com.ai.entity.network;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * DS收到AG发送的电文内容
 * @Author jiaok
 * @Date 2023-06-20 10:48
 */
@Data
public class AgToDsSysMessage implements Serializable {
    @ApiModelProperty(value = "电文长度")
    private String length;
    @ApiModelProperty(value = "电文号")
    private String teleNo;
    @ApiModelProperty("钢卷号")
    private String matNo;

    @ApiModelProperty("1#机器人打磨起始时间")
    private String startTime1;

    @ApiModelProperty("1#机器人打磨结束时间")
    private String endTime1;

    @ApiModelProperty("1#机器人打磨轨迹模式")
    private String trackModel1;

    @ApiModelProperty("1#机器人下压力")
    private BigDecimal downForce1;

    @ApiModelProperty("2#机器人打磨起始时间")
    private String startTime2;

    @ApiModelProperty("2#机器人打磨结束时间")
    private String endTime2;

    @ApiModelProperty("2#机器人打磨轨迹模式")
    private String trackModel2;

    @ApiModelProperty("2#机器人下压力")
    private BigDecimal downForce2;

    @ApiModelProperty("上下表面标记")
    private String surfaceFlag;
    @ApiModelProperty("预留字段")
    private String spare;

    @ApiModelProperty("信号来源")
    private String clientIp;

    @ApiModelProperty("端口")
    private Integer sourcePort;

    @ApiModelProperty("netty客户端code")
    private String nettyCode;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @Override
    public boolean equals(Object o) {
        if (o == null){
            return false;
        }
        AgToDsSysMessage that = (AgToDsSysMessage) o;
        that.setDownForce1(that.getDownForce1().setScale(3, RoundingMode.HALF_UP));
        that.setDownForce2(that.getDownForce2().setScale(3, RoundingMode.HALF_UP));
        return length.equals(that.length) && teleNo.equals(that.teleNo) && matNo.equals(that.matNo) && startTime1.equals(that.startTime1) && endTime1.equals(that.endTime1) && trackModel1.equals(that.trackModel1) && downForce1.equals(that.downForce1) && startTime2.equals(that.startTime2) && endTime2.equals(that.endTime2) && trackModel2.equals(that.trackModel2) && downForce2.equals(that.downForce2) && surfaceFlag.equals(that.surfaceFlag) && spare.equals(that.spare);
    }

}
